/* GUI CONVERTED from rcshmta.i (converter v1.75) Thu Jul 19 05:35:21 2001 */
/* rcshmta.i - Release Management Customer Schedules                         */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                       */
/* All rights reserved worldwide.  This is an unpublished work.              */
/* $Revision: 1.5.1.3 $            */
/*V8:ConvertMode=Maintenance                                                 */
/* REVISION: 7.3      LAST MODIFIED: 10/12/92   BY: WUG *G462*               */
/* REVISION: 7.3      LAST MODIFIED: 07/07/93   BY: WUG *GD26*               */
/* REVISION: 7.3      LAST MODIFIED: 04/20/94   BY: WUG *GJ46*               */
/* REVISION: 7.3      LAST MODIFIED: 12/15/94   BY: RXM *GN16*               */
/* REVISION: 7.3      LAST MODIFIED: 09/06/95   BY: vrn *G0VP*               */
/* REVISION: 7.3      LAST MODIFIED: 09/17/95   BY: vrn *G0X8*               */
/* REVISION: 8.6      LAST MODIFIED: 04/09/97   BY: *K08N* Steve Goeke       */
/* REVISION: 8.6      LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan        */
/* REVISION: 8.6      LAST MODIFIED: 02/17/00   BY: *K25J* Abhijeet Thakur   */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb               */
/* Old ECO marker removed, but no ECO header exists *F0PN*               */
/* $Revision: 1.5.1.3 $  BY: Ellen Borden    DATE: 07/09/01   ECO: *P007* */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/


/* SHIPPER MAINT INCLUDE */

/* WHEN WE ARE HERE, WE HAVE NEITHER PARENT OR CHILD RECORDS.
THIS IS BECAUSE WE DON'T WANT THE USER CHANGING SHIPFROM/SHIPTO
INFO WHICH WOULD CAUSE INCONSISTENCY IN THE STRUCTURE */

define variable addr as character.

ststatus = stline[2].
status input ststatus.

set abs_shipto go-on(F5 CTRL-D).

if lastkey = keycode("F5") or lastkey = keycode("CTRL-D") then do:
   del-yn = yes.
   {pxmsg.i &MSGNUM = 11 &ERRORLEVEL = 1 &CONFIRM = del-yn}
   if del-yn = no then undo, retry.

   /* Delete additional shipper info using form services */
   {gprun.i  ""sofsde.p""  "(recid(abs_mstr))" }
/*GUI*/ if global-beam-me-up then undo, leave.


   if using_container_charges or using_line_charges then
      for each absd_det exclusive-lock
         where absd_abs_id = abs_id
         and absd_shipfrom = abs_shipfrom:
         delete absd_det.
   end. /*FOR EACH ABSD_DET*/
   if using_line_charges then do:
      for each absl_det exclusive-lock
         where absl_abs_id = abs_id
         and absl_abs_shipfrom = abs_shipfrom:
         delete absl_det.
      end. /*FOR EACH ABSL_DET*/

      for each sodlc_det exclusive-lock where
         sodlc_owned_by = abs_id               and
         sodlc_abs_shipfrom = abs_shipfrom     and
         sodlc_order = abs_order               and
         sodlc_ord_line = integer(abs_line):
         delete sodlc_det.
      end. /* FOR EACH SODLC_DET */
   end. /* IF USING_LINE_CHARGES */
   delete abs_mstr.
   clear frame a.
/*GUI*/ RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
   clear frame b.
/*GUI*/ RECT-FRAME-LABEL:SCREEN-VALUE in frame b = F-b-title.
   next mainloop.
end.

find first ls_mstr where ls_addr = abs_shipto
   and (ls_type = "customer"
   or ls_type = "ship-to"
   or ls_type = "dock") no-lock no-error.

if not available ls_mstr
then do:
   {pxmsg.i &MSGNUM=8129 &ERRORLEVEL=3}
   bell.
   next-prompt abs_shipto.
   undo, retry.
end.

find ad_mstr where ad_addr = abs_shipto no-lock no-error.
display ad_name ad_line1.

assign abs_dataset = "sod_det".

find cm_mstr where cm_addr = ad_addr no-lock no-error.

do while not available cm_mstr and ad_ref > "":
   addr = ad_ref.
   find ad_mstr where ad_addr = addr no-lock.

   find cm_mstr where cm_addr = ad_addr no-lock no-error.
end.

if not available cm_mstr then do:
   pause 5.
   {pxmsg.i &MSGNUM=8129 &ERRORLEVEL=3}
   bell.
   next-prompt abs_shipto.
   undo, retry.
end.

if cm_cr_hold then do:
   {pxmsg.i &MSGNUM=614 &ERRORLEVEL=2} /* CUSTOMER ON CREDIT HOLD */
end.

if abs__qad01 = ""
   or substring(abs__qad01,1,40) = fill(" ",40)
then do:

   for first ad_mstr
         fields(ad_addr ad_ref)
         where ad_addr = abs_shipto no-lock:
   end. /* FOR FIRST AD_MSTR */
   if available ad_mstr then
   do:
      find first scx_ref
         where scx_type = 1
         and scx_shipfrom = abs_shipfrom
         and scx_shipto = ad_addr
         no-lock no-error.

      do while not available scx_ref and ad_ref > "":
         addr = ad_ref.
         find ad_mstr where ad_addr = addr no-lock.

         find first scx_ref
            where scx_type = 1
            and scx_shipfrom = abs_shipfrom
            and scx_shipto = ad_addr
            no-lock no-error.
      end.
   end. /* IF AVAILABLE AD_MSTR */

   if available scx_ref then do:
      find so_mstr where so_nbr = scx_order no-lock.

      substring(abs__qad01,1,40) = string(so_shipvia,"x(20)")
         + string(so_fob,"x(20)").
   end.
   else do:
      find first soc_ctrl no-lock.

      substring(abs__qad01,1,40) = string(cm_shipvia,"x(20)")
         + string(soc_fob,"x(20)").
   end.
end.
